import { getUsername } from "@/utils/app";

const state = {
    // 菜单收缩状态
    isCollapse: false || JSON.parse(sessionStorage.getItem("isCollapse")),
    token: '',
    username: '' || getUsername()
}
const getters = {
    isCollapse: state => state.isCollapse
}
const mutations = {
    SET_COLLAPSE(state) {
        state.isCollapse = !state.isCollapse;
        sessionStorage.setItem("isCollapse", JSON.stringify(state.isCollapse));
    },
    SET_TOKEN(state, value) {
        state.token = value;
    },
    SET_USERNAME(state, value) {
        state.username = value;
    }
}

export default {
    namespaced: true,
    state,
    getters,
    mutations
}